//
//  ReceiveAddressCell.m
//  WorkNest
//
//  Created by giantumbrella on 15/7/29.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "ReceiveAddressCell.h"
#import "ReceiveAddressModel.h"

@interface ReceiveAddressCell ()
@property (nonatomic,strong) UIView *bgView;
@property (nonatomic,strong) UILabel *labelName;
@property (nonatomic,strong) UILabel *labelTelphone;
@property (nonatomic,strong) UILabel *labelAddress;
//@property (nonatomic,strong) UILabel *labelName;

@end
@implementation ReceiveAddressCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createSubviews];
        }
    return self;
}

- (void)createSubviews
{
    CGFloat labelX = 10;
    CGFloat labelY = 5;
    CGFloat labelW = SCREEN_WIDTH-40;
    CGFloat labelH = 120/4;
    
    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(10, 5, SCREEN_WIDTH-20, 120)];
    [self addSubview:self.bgView];
    self.bgView.layer.cornerRadius = 3;
    self.bgView.clipsToBounds = YES;
    self.bgView.layer.borderColor = [UIUtil colorWithHexString:@"#DFE0E3"].CGColor;
    self.bgView.layer.borderWidth = 1;
    self.bgView.backgroundColor = [UIColor whiteColor];

    
    //姓名
    self.labelName = [[UILabel alloc] initWithFrame:CGRectMake(labelX, labelY, labelW, labelH)];
    [self.bgView addSubview:self.labelName];
    self.labelName.textColor = [UIUtil colorWithHexString:@"#4E4F50"];
    self.labelName.font = [UIFont systemFontOfSize:18];
    
    //手机号
    self.labelTelphone = [[UILabel alloc] initWithFrame:CGRectMake(labelX, labelY+labelH, labelW, labelH)];
    [self.bgView addSubview:self.labelTelphone];
    self.labelTelphone.textColor = [UIUtil colorWithHexString:@"#9FA0A1"];
    self.labelTelphone.font = [UIFont systemFontOfSize:14];
    
    //收货地址
    self.labelAddress = [[UILabel alloc] initWithFrame:CGRectMake(labelX, labelY+labelH*2, labelW, labelH*2)];
    [self.bgView addSubview:self.labelAddress];
    self.labelAddress.textColor = [UIUtil colorWithHexString:@"#9FA0A1"];
    self.labelAddress.font = [UIFont systemFontOfSize:14];
}

- (void)layoutSubviews
{
    self.labelName.text = [NSString stringWithFormat:@"姓名：%@",self.addressModel.receiveaddName];
    self.labelTelphone.text = [NSString stringWithFormat:@"手机号：%@",self.addressModel.receiveaddTelphone];
    self.labelAddress.text = [NSString stringWithFormat:@"收货地址：%@",self.addressModel.receiveaddAddress];
    self.labelAddress.numberOfLines = 3;
    [self.labelAddress sizeToFit];
    
}
@end
